
var inId
window.onload = function (){
    inId = getQuery("id");
    findUserId()
    findin(null)
}
function findin(info){
    console.log(inId);
    axios.get("/in/findById",{
        params:{
            id:inId
        }
    }).then(resp=>{

      var info= resp.data
        $("name1").innerHTML=info.name
        $("date2").innerHTML=info.date
        var str="";
      console.log(info)
       info.list.forEach(n =>{
            str += `<span>${n.user.name}:</span><span>${n.content}</span><br>`;
        });
        $("data").innerHTML = str;
    })
}
function addSpeak(){
    axios.get("/speak/add",{
        params: {
            name:$("title").value,
            inId:inId,
            content:$("content").value
        }
    }).then(resp=>{
        let info= resp.data;
        console.log(info)
        if (info!=null) {
            findin(info)
        }
    })
}
function findUserId(){
    axios.get("/user/getLoginUser",{
    }).then(resp=>{
        var info=resp.data;
        $("userName").innerHTML=info.name
        $("img").src="/emFace/"+info.imgPath;
        $("date").innerHTML=info.date;

    })

}


